
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	
	<!-- END RIBBON -->
	<div class="content">
		<div class="panel panel-default panel-intro">
			
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade active in" id="one">
						<div class="widget-body no-padding">
							<div class="bootstrap-table">

								<div class="fixed-table-container">
									<div class="fixed-table-body">
										
											<form class="layui-form" >
												<div class="layui-form-item">
													<label class="layui-form-label">上个版本：</label>
													<div class="layui-input-block">
														<input type="text" value="{$edition|default='无'}" disabled class="layui-input">
													</div>
												</div>
													
												<div class="layui-form-item">
													<label class="layui-form-label">版本号：</label>
													<div class="layui-input-block">
														<input type="text" id="edition" placeholder="例如：V1.0.0.1" class="layui-input">
													</div>
												</div>

												<div class="layui-form-item">
													<label class="layui-form-label">发布时间：</label>
													<div class="layui-input-block">
														<input type="text" id="time" class="layui-input">
													</div>
												</div>


												<div class="layui-form-item">
													<label class="layui-form-label">启用/禁用：</label>
													<div class="layui-input-block">
														<input type="checkbox" name="status" id="status" value="1" lay-skin="switch" lay-text="启用|禁用">
													</div>
												</div>
												<div class="layui-form-item layui-form-text">
													<label class="layui-form-label">更新内容：</label>
													<div class="layui-input-block">
														<textarea name="desc" placeholder="可为空" class="layui-textarea" id="content"></textarea>
													</div>
												</div>
											</form>

									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
var index;
layui.use(['form', 'laydate', 'layedit'], function(){
	var form = layui.form, laydate = layui.laydate, layedit = layui.layedit;
	laydate.render({
		elem: '#time',type: 'datetime'
	});
	//建立编辑器
	layedit.set({
		uploadImage: {
			url: '{:url("common/add_images")}'
		}
	});
	index = layedit.build('content');
});

function doSubimt() {
	var res;
	var layedit = layui.layedit;
	var edition         = $('#edition').val();
	var time            = $('#time').val();
	var status      	= (document.getElementById("status").checked === true) ? $('#status').attr('value') : 0;
	var content         = layedit.getContent(index);
	var data            = {edition:edition, 'time':time, 'status':status, 'content':content};

	if (edition == '') {
		$.thinkmimi({Content : '版本号不能为空！', Type:2, Align:'right', OutTime:2000});return false;
	}
	if (time == '') {
		$.thinkmimi({Content : '发布时间不能为空！', Type:2, Align:'right', OutTime:2000});return false;
	}
	if (content == '') {
		$.thinkmimi({Content : '版本更新内容不能为空！', Type:2, Align:'right', OutTime:2000});return false;
	}

	$.ajax({
		type: 'post',
		data: data,
		async: false,
		url: "{:url('add')}",
		success: function(data) {
			var array = eval('('+data+')');
			res = array;
			if (array['code'] == '01') {
				$.thinkmimi({Content : array['msg'], Type:2, Align:'right', OutTime:2000});
				res = false;
			}
		}
	});
	return res;
}
</script>